<?php
class FindNoIndividu{
	private $no_individu;
	private $db;
	
	function FindNoIndividu($db=NULL, $no_individu=NULL){
		$this->no_individu 	 = $no_individu;
		$this->db 			 = $db;
	}	
	
	function response(){
		$q = "SELECT COUNT(*) FROM `caramel_managerial`.`pancang` WHERE `no_individu`='".$this->no_individu."'";
		$r = $this->db->get_var($q);
		
		if( $r > 0 ){
			// cari di biodata... no individu tidak boleh ada yang sama dengan yang lalu2...
			$q = "SELECT COUNT(*) FROM `caramel_managerial`.`biodata_tanaman` WHERE `no_individu`='".$this->no_individu."'";
			$r = $this->db->get_var($q);
			
			if( $r > 0 )
				echo "true";
			else
				echo "false";
		}	
		else
			echo "false";
	}	
}

$no_individu	= $_GET['no_individu'];

// load database class handler
include_once '../config/db_config.php';
include '../library/ezsql/shared/ez_sql_core.php';
include '../library/ezsql/mysql/ez_sql_mysql.php';

// database handler
$db = new ezSQL_mysql($dbUser, $dbPass, $dbName, $dbHost);
$finder = new FindNoIndividu($db, $no_individu);
$finder->response();
?>